import java.util.Arrays;

public class Main {

    public static void main(String[] args) {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("hello");
        stringBuilder.append("world");
        //StringBuffer.append();

        String ret = stringBuilder.toString();
        System.out.println(ret);
    }

    public static void main3(String[] args) {
        String s = "hello";
        //s+="world";
        System.out.println(s);
    }
    
    public static void main2(String[] args) {
        //字符串的截取
        String str1 = "adsadiuaxdqiebd";
        str1.substring(1,3);
        str1.substring(3);

        String str2 = "a  dsadiua   xdqie  bd";
        String ret = str2.trim();
        System.out.println(ret);
    }


    public static void main1(String[] args) {
        String str1 = "abcdef";
        //从2下标位置,从后向前，开始寻找我们的字符
        int index = str1.lastIndexOf('c');
        System.out.println(index);
        //char ch = str1.charAt(2);
        //System.out.println(ch);

        String str2 = new String("cdef");
        System.out.println(str2);

        char[] value={'b','i','t'};
        String str3 = new String(value);
        System.out.println(str3);

        String str4 = "Abcdef";
        String str5 = "abcdef";
        System.out.println(str4.equalsIgnoreCase(str5));

        String str6 = "Abcdef";
        String ret = str6.toUpperCase();
        System.out.println(ret);

        String str7 = "Abcdef";
        String ret2 = str7.toLowerCase();
        System.out.println(ret2);

        //字符串转换为数组
        String str8 = "Abcdef";
        char[] value2 = str8.toCharArray();
        System.out.println(Arrays.toString(value2));


        String ret3 = String.format("%d-%d-%d",2008,10,12);


        String str9 = "Abcdefabcabcabcabcd";
        str9.replace('a','k');
        str9.replace("ab","klp");
        //只替换第一个
        str9.replaceFirst("ab","klp");
        //所有的都会进行替换
        str9.replaceAll("ab","klp");



        //字符串的分割
        String str11="zhangsan=name=1234=qwer";
        //这个就是最多分两组
        String[] ret4 = str11.split("=",2);
        for(int i=0;i<ret4.length;i++){
            System.out.println(ret4[i]);
        }

        //点号的特殊情况
        String str12="zhangsan.name.1234.qwer";
        //这个就是最多分两组
        String[] ret5 = str12.split("\\.");
        for(int i=0;i<ret5.length;i++){
            System.out.print(ret5[i]);
        }
    }
}